package online.hxstart.code.java8.chapter05;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author huxing
 * @date 2019/6/21 星期五 18:32
 * @describe
 */
public class StreamTest2 {

  public static void main(String[] args) {
    //
    String[] arrayOfWords = {"hello", "world"};
    Stream<String> streamOfWords = Arrays.stream(arrayOfWords);
    List<String> list =
        streamOfWords
            .map(w -> w.split(""))
            .flatMap(Arrays::stream)
            .distinct()
            .collect(Collectors.toList());
    System.out.println(list
    );
  }
}
